package client.structural.adapter;

import org.junit.Test;
import org.xml.sax.SAXException;
import uml.structural.adapter.CarController;
import util.bean.BeanUtil;
import util.xml.XMLUtil;

import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;

/**
 * 适配器（包装器）--客户端<br>
 * 客户端针对抽象目标接口编程<br>
 * 适配器模式将现有的接口转换为客户端所期望的接口，实现对已有类的复用
 * on 2022/12/23 0:54
 */
public class Client {
    @Test
    public void t() throws ParserConfigurationException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, SAXException {
        CarController carController = BeanUtil.newBean(
                CarController.class,
                new File("src/main/resources/xml/adapter.xml"),
                "adapterName");
        carController.move();
        carController.lamp();
        carController.twinkle();
    }
}
